from typing import Any

from aiogram import types
from aiogram_dialog import DialogManager, Window
from aiogram_dialog.widgets.kbd import Button, Cancel, Group

from app.bot.dialog.dialog_states import SelectProxySG
from app.bot.dialog.widgets import LocaleText


async def set_proxy_type(
    call: types.CallbackQuery, widget: Any, manager: DialogManager
):
    manager.dialog_data["proxy_type"] = widget.widget_id
    await manager.switch_to(
        SelectProxySG.select_proxy_privacy,
    )


proxy_types_window = Window(
    LocaleText("select-proxy-type"),
    Group(
        # Button(LocaleText("server"), id="server", on_click=set_proxy_type),
        Button(LocaleText("mobile"), id="mobile", on_click=set_proxy_type),
        width=2,
    ),
    Cancel(LocaleText("cancel-btn")),
    state=SelectProxySG.list_proxy_types,
)
